jQuery(document).ready(function($){
    
    
    /*
     * Menu Drop Downs
     */
    $('.nav li, .menu li').not(':animated').hover(
        function() {
            
            // Close all open menus
            $(this).find('.children, .sub-menu').hide();
            
            var subTest = $(this).find('.children, .sub-menu').size();
        
            if ( subTest >= 1 ) {
                $(this).find('.children, .sub-menu')
                       .animate({ opacity: 'toggle', height: 'toggle' }, 'fast');
            }
            
            // Add active class to clicked link
            $(this).addClass('active');
        },
        function() {
            $(this).removeClass('active');
            $(this).find('.children, .sub-menu').slideUp('fast');
        }
    );
    
    
    /*
     * Show drop down menu of current page, but only on sidebar
     */
    $('#sidebar .current_page_ancestor').find('.children, .sub-menu').show();


    /*
     * Show drop down menu of current page, but only on sidebar
     */
    var logoWidth = $('#logo img').width();
    var menuWidth = $('#container').width() - logoWidth;
        
    $('.top.menu, .title').width(menuWidth);
    
});